import { UnityEngine } from "csharp";
import { $typeof } from "puerts";

const player = UnityEngine.GameObject.Find("Capsule");
UnityEngine.Camera.main.transform.SetParent(player.transform);
UnityEngine.Camera.main.transform.position = new UnityEngine.Vector3(0,2,-3.5);
UnityEngine.Camera.main.transform.Rotate(15,0,0);

setInterval(()=>{
    const moveX:number = UnityEngine.Input.GetAxis("Horizontal") * UnityEngine.Time.deltaTime * 200;
    const moveZ:number = UnityEngine.Input.GetAxis("Vertical") * UnityEngine.Time.deltaTime * 8;
    player.transform.Rotate(0,moveX,0);
    player.transform.Translate(0,0,moveZ);

    if(UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode.Space)){
        const rb = player.GetComponent($typeof(UnityEngine.Rigidbody)) as UnityEngine.Rigidbody;
        rb.AddForce(new UnityEngine.Vector3(0,5,0),UnityEngine.ForceMode.Impulse);
    }
});